/*
 * @Author: shengduiliang 1107722390@qq.com
 * @Date: 2024-05-04 15:01:26
 * @LastEditors: shengduiliang 1107722390@qq.com
 * @LastEditTime: 2024-05-04 22:20:51
 * @FilePath: /treasure/src/network/user.ts
 * @Description: 用户信息接口
 */
import { User } from "@/store/userSlice"
import { Gender } from "@/types"
import http from "./http"


export const getUserInfo: () => Promise<User> = async () => {
  return http.get({
    url: '/user'
  })
}

export interface UserParams {
  username: string
  avatar: string
  gender: Gender
  birthday: string
}

export const updateUserInfo = async (user: UserParams) => {
  return http.post({
    url: '/user/update',
    data: user
  })
}